home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / rcs55.zip / RCSREV.C < prev    next >
C/C++ Source or Header  |  1991-09-15  |  21KB  |  703 lines

  1. /*
  2.  *                     RCS revision number handling
  3.  */
  4.  
  5. /* Copyright (C) 1982, 1988, 1989 Walter Tichy
  6.    Copyright 1990 by Paul Eggert
  7.    Distributed under license by the Free Software Foundation, Inc.
  8.  
  9. This file is part of RCS.
  10.  
  11. RCS is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 1, or (at your option)
  14. any later version.
  15.  
  16. RCS is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with RCS; see the file COPYING.  If not, write to
  23. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25. Report problems and direct all questions to:
  26.  
  27.     rcs-bugs@cs.purdue.edu
  28.  
  29. */
  30.  
  31.  
  32.  
  33.  
  34. /* $Log: rcsrev.c%v $
  35.  * Revision 1.2  1991/08/23  13:37:21  SGP
  36.  * Ported to MSDOS using Borland C++
  37.  *
  38.  * Revision 5.0  1990/08/22  08:13:43  eggert
  39.  * Remove compile-time limits; use malloc instead.
  40.  * Ansify and Posixate.  Tune.
  41.  * Remove possibility of an internal error.  Remove lint.
  42.  *
  43.  * Revision 4.5  89/05/01  15:13:22  narten
  44.  * changed copyright header to reflect current distribution rules
  45.  * 
  46.  * Revision 4.4  87/12/18  11:45:22  narten
  47.  * more lint cleanups. Also, the NOTREACHED comment is no longer necessary, 
  48.  * since there's now a return value there with a value. (Guy Harris)
  49.  * 
  50.  * Revision 4.3  87/10/18  10:38:42  narten
  51.  * Updating version numbers. Changes relative to version 1.1 actually 
  52.  * relative to 4.1
  53.  * 
  54.  * Revision 1.3  87/09/24  14:00:37  narten
  55.  * Sources now pass through lint (if you ignore printf/sprintf/fprintf 
  56.  * warnings)
  57.  * 
  58.  * Revision 1.2  87/03/27  14:22:37  jenkins
  59.  * Port to suns
  60.  * 
  61.  * Revision 4.1  83/03/25  21:10:45  wft
  62.  * Only changed $Header to $Id.
  63.  * 
  64.  * Revision 3.4  82/12/04  13:24:08  wft
  65.  * Replaced getdelta() with gettree().
  66.  *
  67.  * Revision 3.3  82/11/28  21:33:15  wft
  68.  * fixed compartial() and compnum() for nil-parameters; fixed nils
  69.  * in error messages. Testprogram output shortenend.
  70.  *
  71.  * Revision 3.2  82/10/18  21:19:47  wft
  72.  * renamed compnum->cmpnum, compnumfld->cmpnumfld,
  73.  * numericrevno->numricrevno.
  74.  *
  75.  * Revision 3.1  82/10/11  19:46:09  wft
  76.  * changed expandsym() to check for source==nil; returns zero length string
  77.  * in that case.
  78.  */
  79.  
  80.  
  81.  
  82. /*
  83. #define REVTEST
  84. */
  85. /* version REVTEST is for testing the routines that generate a sequence
  86.  * of delta numbers needed to regenerate a given delta.
  87.  */
  88.  
  89. #include "rcsbase.h"
  90.  
  91. libId(revId, "$Id: rcsrev.c%v 1.2 1991/08/23 13:37:21 SGP Exp $")
  92.  
  93. static struct hshentry *genbranch P((const struct hshentry*,const char*,unsigned,const char*,const char*,const char*,struct hshentries**));
  94.  
  95.  
  96.  
  97.     unsigned
  98. countnumflds(const char *s)
  99. /* Given a pointer s to a dotted number (date or revision number),
  100.  * countnumflds returns the number of digitfields in s.
  101.  */
  102. {
  103.     register const char *sp;
  104.     register unsigned count;
  105.         if ((sp=s)==nil) return(0);
  106.         if (*sp == '\0') return(0);
  107.         count = 1;
  108.     do {
  109.                 if (*sp++ == '.') count++;
  110.     } while (*sp);
  111.         if (*(--sp) == '.') count--; /*trailing periods don't count*/
  112.         return(count);
  113. }
  114.  
  115.     void
  116. getbranchno(const char *revno,struct buf *branchno)
  117. /* Given a non-nil revision number revno, getbranchno copies the number of the branch
  118.  * on which revno is into branchno. If revno itself is a branch number,
  119.  * it is copied unchanged.
  120.  */
  121. {
  122.     register unsigned numflds;
  123.     register char *tp;
  124.  
  125.     bufscpy(branchno, revno);
  126.         numflds=countnumflds(revno);
  127.     if (!(numflds & 1)) {
  128.         tp = branchno->string;
  129.         while (--numflds)
  130.             while (*tp++ != '.')
  131.                 ;
  132.                 *(tp-1)='\0';
  133.         }
  134. }
  135.  
  136.  
  137.  
  138. int cmpnum(const char *num1, const char *num2)
  139. /* compares the two dotted numbers num1 and num2 lexicographically
  140.  * by field. Individual fields are compared numerically.
  141.  * returns <0, 0, >0 if num1<num2, num1==num2, and num1>num2, resp.
  142.  * omitted fields are assumed to be higher than the existing ones.
  143. */
  144. {
  145.     register const char *s1, *s2;
  146.         register int n1, n2;
  147.  
  148.         s1=num1==nil?"":num1;
  149.         s2=num2==nil?"":num2;
  150.  
  151.         do {
  152.                 n1 = 0;
  153.         while (isdigit(*s1))
  154.             n1 = n1*10 + (*s1++ - '0');
  155.                 /* skip '.' */
  156.                 if (*s1=='.') s1++;
  157.  
  158.                 n2 = 0;
  159.         while (isdigit(*s2))
  160.             n2 = n2*10 + (*s2++ - '0');
  161.                 /* skip '.' */
  162.                 if (*s2=='.') s2++;
  163.  
  164.         } while ((n1==n2) && (*s1!='\0') && (*s2!='\0'));
  165.  
  166.         if (((*s1=='\0') && (*s2=='\0')) || (n1!=n2))
  167.                 return (n1 - n2);
  168.         /*now n1==n2 and one of s1 or s2 is shorter*/
  169.         /*give precedence to shorter one*/
  170.         if (*s1=='\0') return 1;
  171.         else           return -1;
  172.  
  173. }
  174.  
  175.  
  176.  
  177. int cmpnumfld(const char *num1, const char *num2, unsigned fld)
  178. /* compares the two dotted numbers at field fld and returns
  179.  * num1[fld]-num2[fld]. Assumes that num1 and num2 have at least fld fields.
  180.  * fld must be positive.
  181. */
  182. {
  183.     register const char *s1, *s2;
  184.     register unsigned n1, n2;
  185.  
  186.     s1 = num1;
  187.     s2 = num2;
  188.         /* skip fld-1 fields */
  189.     for (n1 = fld;  (--n1);  ) {
  190.         while (*s1++ != '.')
  191.             ;
  192.         while (*s2++ != '.')
  193.             ;
  194.     }
  195.         /* Now s1 and s2 point to the beginning of the respective fields */
  196.         /* compute numerical value and compare */
  197.         n1 = 0;
  198.     while (isdigit(*s1))
  199.         n1 = n1*10 + (*s1++ - '0');
  200.         n2 = 0;
  201.     while (isdigit(*s2))
  202.         n2 = n2*10 + (*s2++ - '0');
  203.     return n1<n2 ? -1 : n1==n2 ? 0 : 1;
  204. }
  205.  
  206.  
  207.     int
  208. compartial(const char *num1, const char *num2, unsigned length)
  209.  
  210. /*   compare the first "length" fields of two dot numbers;
  211.      the omitted field is considered to be larger than any number  */
  212. /*   restriction:  at least one number has length or more fields   */
  213.  
  214. {
  215.     register const char *s1, *s2;
  216.         register        int     n1, n2;
  217.  
  218.  
  219.         s1 = num1;      s2 = num2;
  220.         if ( s1==nil || *s1 == '\0' ) return 1;
  221.         if ( s2==nil || *s2 == '\0' ) return -1;
  222.  
  223.     for (;;) {
  224.             n1 = 0;
  225.         while (isdigit(*s1))
  226.         n1 = n1*10 + (*s1++ - '0');
  227.             if ( *s1 == '.' ) s1++;    /*  skip .   */
  228.  
  229.             n2 = 0;
  230.         while (isdigit(*s2))
  231.         n2 = n2*10 + (*s2++ - '0');
  232.             if (*s2 == '.') s2++;
  233.  
  234.         if ( n1 != n2 ) return n1-n2;
  235.         if ( --length == 0 ) return 0;
  236.         if ( *s1 == '\0' ) return 1;
  237.         if ( *s2 == '\0' ) return -1;
  238.     }
  239. }
  240.  
  241.  
  242. char * partialno(struct buf *rev1,
  243.                  const char *rev2,
  244.                  register unsigned length)
  245. /* Function: Copies length fields of revision number rev2 into rev1.
  246.  * Return rev1's string.
  247.  */
  248. {
  249.     register char *r1;
  250.  
  251.     bufscpy(rev1, rev2);
  252.     r1 = rev1->string;
  253.         while (length) {
  254.         while (*r1!='.' && *r1)
  255.             ++r1;
  256.         ++r1;
  257.                 length--;
  258.         }
  259.         /* eliminate last '.'*/
  260.         *(r1-1)='\0';
  261.     return rev1->string;
  262. }
  263.  
  264.  
  265.  
  266.  
  267.     static void
  268. store1(struct hshentries ***store, struct hshentry *next)
  269. /*
  270.  * Allocate a new list node that addresses NEXT.
  271.  * Append it to the list that **STORE is the end pointer of.
  272.  */
  273. {
  274.     register struct hshentries *p;
  275.  
  276.     p = ftalloc(struct hshentries);
  277.     p->first = next;
  278.     **store = p;
  279.     *store = &p->rest;
  280. }
  281.  
  282. struct hshentry * genrevs(const char *revno,
  283.                           const char *date,
  284.                           const char *author,
  285.                           const char *state,
  286.                           struct hshentries **store)
  287. /* Function: finds the deltas needed for reconstructing the
  288.  * revision given by revno, date, author, and state, and stores pointers
  289.  * to these deltas into a list whose starting address is given by store.
  290.  * The last delta (target delta) is returned.
  291.  * If the proper delta could not be found, nil is returned.
  292.  */
  293. {
  294.     unsigned length;
  295.         register struct hshentry * next;
  296.         int result;
  297.     const char *branchnum;
  298.     struct buf t;
  299.  
  300.     bufautobegin(&t);
  301.  
  302.     if (!(next = Head)) {
  303.         error("RCS file empty");
  304.         goto norev;
  305.         }
  306.  
  307.         length = countnumflds(revno);
  308.  
  309.         if (length >= 1) {
  310.                 /* at least one field; find branch exactly */
  311.         while ((result=cmpnumfld(revno,next->num,1)) < 0) {
  312.             store1(&store, next);
  313.                         next = next->next;
  314.             if (!next) {
  315.                 error("branch number %s too low", partialno(&t,revno,1));
  316.                 goto norev;
  317.             }
  318.                 }
  319.  
  320.         if (result>0) {
  321.             error("branch number %s absent", partialno(&t,revno,1));
  322.             goto norev;
  323.         }
  324.         }
  325.         if (length<=1){
  326.                 /* pick latest one on given branch */
  327.                 branchnum = next->num; /* works even for empty revno*/
  328.                 while ((next!=nil) &&
  329.                        (cmpnumfld(branchnum,next->num,1)==0) &&
  330.                        !(
  331.                         (date==nil?1:(cmpnum(date,next->date)>=0)) &&
  332.                         (author==nil?1:(strcmp(author,next->author)==0)) &&
  333.                         (state ==nil?1:(strcmp(state, next->state) ==0))
  334.                         )
  335.                        )
  336.         {
  337.             store1(&store, next);
  338.                         next=next->next;
  339.                 }
  340.                 if ((next==nil) ||
  341.                     (cmpnumfld(branchnum,next->num,1)!=0))/*overshot*/ {
  342.             error("can't find revision on branch %s with a date before %s, author %s, and state %s",
  343.                 length ? revno : partialno(&t,branchnum,1),
  344.                 date ? date : "<now>",
  345.                                 author==nil?"<any>":author, state==nil?"<any>":state);
  346.             goto norev;
  347.                 } else {
  348.             store1(&store, next);
  349.                 }
  350.                 *store = nil;
  351.                 return next;
  352.         }
  353.  
  354.         /* length >=2 */
  355.         /* find revision; may go low if length==2*/
  356.     while ((result=cmpnumfld(revno,next->num,2)) < 0  &&
  357.                (cmpnumfld(revno,next->num,1)==0) ) {
  358.         store1(&store, next);
  359.                 next = next->next;
  360.         if (!next)
  361.             break;
  362.         }
  363.  
  364.         if ((next==nil) || (cmpnumfld(revno,next->num,1)!=0)) {
  365.         error("revision number %s too low", partialno(&t,revno,2));
  366.         goto norev;
  367.         }
  368.         if ((length>2) && (result!=0)) {
  369.         error("revision %s absent", partialno(&t,revno,2));
  370.         goto norev;
  371.         }
  372.  
  373.         /* print last one */
  374.     store1(&store, next);
  375.  
  376.         if (length>2)
  377.                 return genbranch(next,revno,length,date,author,state,store);
  378.         else { /* length == 2*/
  379.                 if ((date!=nil) && (cmpnum(date,next->date)<0)){
  380.                         error("Revision %s has date %s.",next->num, next->date);
  381.                         return nil;
  382.                 }
  383.                 if ((author!=nil)&&(strcmp(author,next->author)!=0)) {
  384.                         error("Revision %s has author %s.",next->num,next->author);
  385.                         return nil;
  386.                 }
  387.                 if ((state!=nil)&&(strcmp(state,next->state)!=0)) {
  388.                         error("Revision %s has state %s.",next->num,
  389.                                next->state==nil?"<empty>":next->state);
  390.                         return nil;
  391.                 }
  392.                 *store=nil;
  393.                 return next;
  394.         }
  395.     norev:
  396.     bufautoend(&t);
  397.     return nil;
  398. }
  399.  
  400.  
  401.  
  402.  
  403.     static struct hshentry *
  404. genbranch(const struct hshentry *bpoint,
  405.           const char *revno,
  406.           unsigned length,
  407.           const char *date,
  408.           const char *author,
  409.           const char *state,
  410.           struct hshentries **store)
  411. /* Function: given a branchpoint, a revision number, date, author, and state,
  412.  * genbranch finds the deltas necessary to reconstruct the given revision
  413.  * from the branch point on.
  414.  * Pointers to the found deltas are stored in a list beginning with store.
  415.  * revno must be on a side branch.
  416.  * return nil on error
  417.  */
  418. {
  419.     unsigned field;
  420.         register struct hshentry * next, * trail;
  421.     register const struct branchhead *bhead;
  422.         int result;
  423.     struct buf t;
  424.  
  425.     field = 3;
  426.         bhead = bpoint->branches;
  427.  
  428.     do {
  429.         if (!bhead) {
  430.             bufautobegin(&t);
  431.             error("no side branches present for %s", partialno(&t,revno,field-1));
  432.             bufautoend(&t);
  433.             return nil;
  434.         }
  435.  
  436.                 /*find branch head*/
  437.                 /*branches are arranged in increasing order*/
  438.         while (0 < (result=cmpnumfld(revno,bhead->hsh->num,field))) {
  439.                         bhead = bhead->nextbranch;
  440.             if (!bhead) {
  441.                 bufautobegin(&t);
  442.                 error("branch number %s too high",partialno(&t,revno,field));
  443.                 bufautoend(&t);
  444.                 return nil;
  445.             }
  446.                 }
  447.  
  448.         if (result<0) {
  449.             bufautobegin(&t);
  450.             error("branch number %s absent", partialno(&t,revno,field));
  451.             bufautoend(&t);
  452.             return nil;
  453.         }
  454.  
  455.                 next = bhead->hsh;
  456.                 if (length==field) {
  457.                         /* pick latest one on that branch */
  458.                         trail=nil;
  459.                         do { if ((date==nil?1:(cmpnum(date,next->date)>=0)) &&
  460.                                  (author==nil?1:(strcmp(author,next->author)==0)) &&
  461.                                  (state ==nil?1:(strcmp(state, next->state) ==0))
  462.                              ) trail = next;
  463.                              next=next->next;
  464.                         } while (next!=nil);
  465.  
  466.                         if (trail==nil) {
  467.                  error("can't find revision on branch %s with a date before %s, author %s, and state %s",
  468.                                         revno, date==nil?"<now>":date,
  469.                                         author==nil?"<any>":author, state==nil?"<any>":state);
  470.                              return nil;
  471.                         } else { /* print up to last one suitable */
  472.                              next = bhead->hsh;
  473.                              while (next!=trail) {
  474.                   store1(&store, next);
  475.                                   next=next->next;
  476.                              }
  477.                  store1(&store, next);
  478.                         }
  479.             *store = nil;
  480.                         return next;
  481.                 }
  482.  
  483.                 /* length > field */
  484.                 /* find revision */
  485.                 /* check low */
  486.                 if (cmpnumfld(revno,next->num,field+1)<0) {
  487.             bufautobegin(&t);
  488.             error("revision number %s too low", partialno(&t,revno,field+1));
  489.             bufautoend(&t);
  490.                         return(nil);
  491.                 }
  492.         do {
  493.             store1(&store, next);
  494.                         trail = next;
  495.                         next = next->next;
  496.                 } while ((next!=nil) &&
  497.                        (cmpnumfld(revno,next->num,field+1) >=0));
  498.  
  499.                 if ((length>field+1) &&  /*need exact hit */
  500.                     (cmpnumfld(revno,trail->num,field+1) !=0)){
  501.             bufautobegin(&t);
  502.             error("revision %s absent", partialno(&t,revno,field+1));
  503.             bufautoend(&t);
  504.                         return(nil);
  505.                 }
  506.                 if (length == field+1) {
  507.                         if ((date!=nil) && (cmpnum(date,trail->date)<0)){
  508.                                 error("Revision %s has date %s.",trail->num, trail->date);
  509.                                 return nil;
  510.                         }
  511.                         if ((author!=nil)&&(strcmp(author,trail->author)!=0)) {
  512.                                 error("Revision %s has author %s.",trail->num,trail->author);
  513.                                 return nil;
  514.                         }
  515.                         if ((state!=nil)&&(strcmp(state,trail->state)!=0)) {
  516.                                 error("Revision %s has state %s.",trail->num,
  517.                                        trail->state==nil?"<empty>":trail->state);
  518.                                 return nil;
  519.                         }
  520.                 }
  521.                 bhead = trail->branches;
  522.  
  523.     } while ((field+=2) <= length);
  524.         * store = nil;
  525.         return trail;
  526. }
  527.  
  528.  
  529.     static const char *
  530. lookupsym(const char *id)
  531. /* Function: looks up id in the list of symbolic names starting
  532.  * with pointer SYMBOLS, and returns a pointer to the corresponding
  533.  * revision number. Returns nil if not present.
  534.  */
  535. {
  536.     register const struct assoc *next;
  537.         next = Symbols;
  538.         while (next!=nil) {
  539.                 if (strcmp(id, next->symbol)==0)
  540.             return next->num;
  541.                 else    next=next->nextassoc;
  542.         }
  543.         return nil;
  544. }
  545.  
  546. int expandsym(const char *source, struct buf *target)
  547. /* Function: Source points to a revision number. Expandsym copies
  548.  * the number to target, but replaces all symbolic fields in the
  549.  * source number with their numeric values.
  550.  * A trailing '.' is omitted; leading zeroes are compressed.
  551.  * returns false on error;
  552.  */
  553. {
  554.     register const char *sp;
  555.     register char *tp;
  556.     const char *tlim;
  557.         register enum tokens d;
  558.  
  559.     bufalloc(target, 1);
  560.     tp = target->string;
  561.     sp = source;
  562.         if (sp == nil) { /*accept nil pointer as a legal value*/
  563.                 *tp='\0';
  564.                 return true;
  565.         }
  566.     tlim = tp + target->size;
  567.  
  568.         while (*sp != '\0') {
  569.         switch (ctab[(unsigned char)*sp]) {
  570.             case DIGIT:
  571.                         if (*sp=='0') {
  572.                                 /* skip leading zeroes */
  573.                                 sp++;
  574.                                 while(*sp == '0') sp++;
  575.                 if (!*sp || *sp=='.') --sp; /* single zero */
  576.                         }
  577.             while (isdigit(*sp)) {
  578.                 if (tlim <= tp)
  579.                     tp = bufenlarge(target, &tlim);
  580.                 *tp++ = *sp++;
  581.             }
  582.             if (tlim <= tp)
  583.                 tp = bufenlarge(target, &tlim);
  584.                         if ((*sp == '\0') || ((*sp=='.')&&(*(sp+1)=='\0'))) {
  585.                                 *tp='\0'; return true;
  586.                         }
  587.             if (*sp != '.')
  588.                 goto improper;
  589.             *tp++ = *sp++;
  590.             break;
  591.  
  592.             case LETTER:
  593.             case Letter:
  594.             {
  595.             register char *bp = tp;
  596.             register size_t s = tp - target->string;
  597.             do {
  598.                 if (tlim <= bp)
  599.                     bp = bufenlarge(target, &tlim);
  600.                 *bp++ = *sp++;
  601.             } while ((d=ctab[(unsigned char)*sp])==LETTER ||
  602.                   d==Letter || d==DIGIT ||
  603.                               (d==IDCHAR));
  604.             if (tlim <= bp)
  605.                 bp = bufenlarge(target, &tlim);
  606.                         *bp= '\0';
  607.             tp = target->string + s;
  608.             }
  609.             {
  610.             register const char *bp = lookupsym(tp);
  611.                         if (bp==nil) {
  612.                 error("Symbolic number %s is undefined.", tp);
  613.                                 return false;
  614.                         } else { /* copy number */
  615.                 do {
  616.                     if (tlim <= tp)
  617.                         tp = bufenlarge(target, &tlim);
  618.                 } while ((*tp++ = *bp++));
  619.                         }
  620.             }
  621.                         if ((*sp == '\0') || ((*sp=='.')&&(*(sp+1)=='\0')))
  622.                                 return true;
  623.             if (*sp++ != '.')
  624.                 goto improper;
  625.             tp[-1] = '.';
  626.             break;
  627.  
  628.             default:
  629.             improper:
  630.             error("improper revision number: %s", source);
  631.                         return false;
  632.                 }
  633.         }
  634.     if (tlim<=tp)
  635.         tp = bufenlarge(target,&tlim);
  636.         *tp = '\0';
  637.         return true;
  638. }
  639.  
  640.  
  641.  
  642. #ifdef REVTEST
  643.  
  644. const char cmdid[] = "revtest";
  645.  
  646.     int
  647. main(int argc,char *argv[])
  648. {
  649.     static struct buf numricrevno;
  650.     char symrevno[100];       /* used for input of revision numbers */
  651.         char author[20];
  652.         char state[20];
  653.         char date[20];
  654.     struct hshentries *gendeltas;
  655.         struct hshentry * target;
  656.         int i;
  657.  
  658.         if (argc<2) {
  659.         aputs("No input file\n",stderr);
  660.         exitmain(EXIT_FAILURE);
  661.         }
  662.         if ((finptr=fopen(argv[1], "r")) == NULL) {
  663.         faterror("can't open input file %s", argv[1]);
  664.         }
  665.         Lexinit();
  666.         getadmin();
  667.  
  668.         gettree();
  669.  
  670.         getdesc(false);
  671.  
  672.         do {
  673.                 /* all output goes to stderr, to have diagnostics and       */
  674.                 /* errors in sequence.                                      */
  675.         aputs("\nEnter revision number or <return> or '.': ",stderr);
  676.                 if(gets(symrevno)==NULL) break;
  677.                 if (*symrevno == '.') break;
  678.         aprintf(stderr,"%s;\n",symrevno);
  679.         expandsym(symrevno,&numricrevno);
  680.         aprintf(stderr,"expanded number: %s; ",numricrevno.string);
  681.         aprintf(stderr,"Date: ");
  682.         gets(date); aprintf(stderr,"%s; ",date);
  683.         aprintf(stderr,"Author: ");
  684.         gets(author); aprintf(stderr,"%s; ",author);
  685.         aprintf(stderr,"State: ");
  686.         gets(state); aprintf(stderr, "%s;\n", state);
  687.         target = genrevs(numricrevno.string, *date?date:(char *)nil, *author?author:(char *)nil,
  688.                  *state?state:(char*)nil, &gendeltas);
  689.                 if (target!=nil) {
  690.             while (gendeltas) {
  691.                 aprintf(stderr,"%s\n",gendeltas->first->num);
  692.                 gendeltas = gendeltas->next;
  693.                         }
  694.                 }
  695.         } while (true);
  696.     aprintf(stderr,"done\n");
  697.     exitmain(EXIT_SUCCESS);
  698. }
  699.  
  700. exiting void exiterr() { _exit(EXIT_FAILURE); }
  701.  
  702. #endif
  703.